from reward_component import RewardComponent

from utils import get_activity_duration

class TimeEfficiencyComponent(RewardComponent):
    """时间效率奖励组件"""
    def __init__(self, weight=1.0, coefficient=-0.1):
        super().__init__(weight)
        self.coefficient = coefficient
        
    def calculate(self, current_activity, next_activity, case_events, context=None):
        return self.coefficient * get_activity_duration(next_activity)
    
    def get_description(self):
        return "基于活动持续时间的效率奖励"